import { MigrationInterface, QueryRunner } from 'typeorm';

export class UpdateSourcemapProjectType1710000000001
  implements MigrationInterface
{
  name = 'UpdateSourcemapProjectType1710000000001';

  public async up(queryRunner: QueryRunner): Promise<void> {
    // 修改 sourcemap 表的 project_type 字段
    await queryRunner.query(`
      ALTER TABLE \`sourcemap\`
      MODIFY COLUMN \`project_type\` enum('mobile_app', 'workstation', 'console', 'cabinet', 'file_cabinet') NOT NULL;
    `);
  }

  public async down(queryRunner: QueryRunner): Promise<void> {
    // 回滚到原来的枚举值
    await queryRunner.query(`
      ALTER TABLE \`sourcemap\`
      MODIFY COLUMN \`project_type\` enum('console', 'agent') NOT NULL;
    `);
  }
}
